/*
  Custom reset (loosely) based on Tailwind Preflight

  @see https://github.com/tailwindlabs/tailwindcss/blob/3.3/src/css/preflight.css
*/

/* Reset <body> in a layer  */
@layer scalar-base {
  body {
    margin: 0;
    line-height: inherit;
  }
}

/* Use :where to lower specificity */
:where(.scalar-app) {
  /* Apply styles that are normally applied to `html`. */
  font-family: var(--scalar-font);
  line-height: 1.15;
  color: var(--scalar-color-1);

  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;

  *,
  *:before,
  *:after {
    box-sizing: border-box;
    border-width: 0;
    border-style: solid;
    border-color: var(--scalar-border-color);

    outline-width: 1px;
    outline-style: none;
    outline-color: var(--scalar-color-accent);

    font-family: inherit;
    font-feature-settings: inherit;
    font-variation-settings: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-style: inherit;
    text-decoration: inherit;
    text-align: inherit;
    line-height: inherit;
    color: inherit;
    margin: unset;
    padding: unset;

    /** Smooth text rendering */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  ::before,
  ::after {
    --tw-content: "";
  }

  /** Remove the default background color. */
  button,
  input,
  optgroup,
  select,
  textarea,
  ::file-selector-button {
    background: transparent;
  }

  /** Remove the default list style */
  ol,
  ul,
  menu {
    list-style: none;
  }

  /** Bring back a basic border style and focus outline for form controls */
  input:where(:not([type="button"], [type="reset"], [type="submit"])),
  select,
  textarea {
    border-radius: var(--scalar-radius);
    border-width: 1px;
  }

  /** Style placeholder text */
  input::placeholder {
    color: var(--scalar-color-3);
    font-family: var(--scalar-font);
  }

  /** Remove chrome search input decorations */
  input[type="search"]::-webkit-search-cancel-button,
  input[type="search"]::-webkit-search-decoration {
    appearance: none;
  }

  /* Fix for Safari displaying default caret next to `<summary>` */
  summary::-webkit-details-marker {
    display: none;
  }

  /** Remove yellow/blue autofill indicator */
  input:-webkit-autofill {
    background-clip: text !important;
  }

  /** Add outline for focus visible */
  :focus-visible {
    outline-style: solid;
    border-radius: var(--scalar-radius);
  }

  /** Set outline offset for buttons */
  button:focus-visible,
  [role="button"]:focus-visible {
    outline-offset: -1px;
  }

  /** Set the default cursor for buttons. */
  button,
  [role="button"] {
    cursor: pointer;
  }

  /** Make sure disabled buttons don't get the pointer cursor. */
  :disabled {
    cursor: default;
  }

  /**
    1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
    2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
  */

  img,
  svg,
  video,
  canvas,
  audio,
  iframe,
  embed,
  object {
    display: block; /* 1 */
    vertical-align: middle; /* 2 */
  }

  /** Make elements with the HTML hidden attribute stay hidden by default */
  [hidden] {
    display: none;
  }
}
